package cn.shentianlan.controller;

import cn.shentianlan.criteria.ClassroomCriteria;
import cn.shentianlan.domain.dto.ClassroomDTO;
import cn.shentianlan.service.ClassroomService;
import cn.shentianlan.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 陈俊源
 * @Description TODO
 * @Date 2021/4/20
 * @Version 1.0
 */
@RestController
@RequestMapping("/classroom")
public class ClassroomController {

    @Autowired
    private ClassroomService classroomService;

    @PostMapping("/saveOrUpdate")
    public Result saveOrUpdate(ClassroomDTO classroomDTO){
        Result result = classroomService.saveOrUpdate(classroomDTO);
        return result;
    }

    @RequestMapping("/list")
    public Result findClassroomByCriteria(ClassroomCriteria criteria){
        Result result = classroomService.findClassroomByCriteria(criteria);
        return result;
    }

    @RequestMapping("/getClassroomById")
    public Result getClassroomById(Long id){
        Result result = classroomService.getClassroomById(id);
        return result;
    }

    @RequestMapping("/deleteClassroomById")
    public Result deleteClassroomById(Long id){
        Result result = classroomService.deleteClassroomById(id);
        return result;
    }
}
